package com.ctrip.framework.apollo.spring.property;

/**
 * <bean class="com.ctrip.framework.apollo.demo.spring.xmlConfigDemo.bean.XmlBean">
 *     <property name="timeout" value="${timeout:200}"/>
 *     <property name="batch" value="${batch:100}"/>
 * </bean>
 *
 *  每个 <property /> 都会被解析成一个 StringValueDefinition 对象
 *  例如：
 *      key -> value中的timeout
 *      placeholder -> ${timeout:200}
 *      propertyName -> name中的timeout
 */
public class SpringValueDefinition {

    /**
     * KEY
     *
     * 即在 Config 中的属性 KEY 。
     */
    private final String key;
    /**
     * 占位符
     */
    private final String placeholder;
    /**
     * 属性名
     */
    private final String propertyName;

    public SpringValueDefinition(String key, String placeholder, String propertyName) {
        this.key = key;
        this.placeholder = placeholder;
        this.propertyName = propertyName;
    }

    public String getKey() {
        return key;
    }

    public String getPlaceholder() {
        return placeholder;
    }

    public String getPropertyName() {
        return propertyName;
    }
}
